<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //数组中的新增元素
        // 1修改length长度
        // 2length属性是可读写的
        var arr = [1, 2, 3];
        console.log(arr.length);
        //数组扩容
        arr.length = 5;//把数组长度改为5，里面多两个空元素
        console.log(arr);
        console.log(arr[3]);
        console.log(arr[4]);
        //追加,接着下标往后继续
        var arr1 = [1, 2, 3];
        console.log(arr1);
        arr1[3] = 0;
        console.log(arr1);
        //下标占用，替换
        arr1[1] = 'pink';
        console.log(arr1);
        //不要给数组赋值，要给数组里面的元素赋值








        // for (var i = 0; i < arr.length; i++) {

        // }
    </script>
</head>

<body>

</body>

</html>